﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Front.Models.View;
using Share.Models;

namespace eShop.Controllers
{
    public class ProductController : Controller
    {
        //
        // GET: /Product/1

        public ActionResult Index(int id)
        {
            VMProductIndex Model = new VMProductIndex();

            Model.Item = DB.Current.Items.Find(id);
            if (Model.Item == null)
                return HttpNotFound();

            Model.Category = Model.Item.Catrgories.First();
            Model.RootCategory = Model.Category.FindRootCategory();
            Model.AlsoLikes = Model.Item.AlsoLikes.ToList();

            return View(Model);
        }

        //
        // GET: /Product/v2

        public ActionResult v2()
        {
            return View();
        }
    }
}
